package com.simulate2.demo.dao;

import com.simulate2.demo.entity.Commision;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.query.Procedure;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;


public interface CommisionRepository extends MongoRepository<Commision, String> {

    Commision findByuId(Integer uId);

    //用于按照uId和date_commisionList.date进行查询
    @Query(value = "{'uId': ?0 ,'date_commisionList.date': ?1 }")
    Commision findByuIDAnddate(Integer uId, Integer date);

    /*@Query(value = "{update({'uId': ?0, '_class': 'com.simulate2.demo.entity.Commision'},{'$push': {'date_commisionList': {'date': ?1,'uCommision': ?2}} },1)}")
    Commision myUpdate(Integer uId,Integer date,Integer uCommision);*/


}
